# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.conf import settings
from models import News
from django.views.generic.list_detail import object_list, object_detail
from pygameweb.comments.views import generic_comment_wrapper

urlpatterns = patterns('',
    url(r'^$', object_list,
           {"queryset": News.active_objects.all(),
            "paginate_by": settings.NEWS_PER_PAGE,
            "template_name": "utils/overview.html",
            "extra_context": {"base_template": "news/base.html",
                              "segment_template": "news/segment.html",
                              "truncate_chars":settings.NEWS_TRUNCATE_WORDS, 
                              },
            }, name="news_overview"),
    url(r'^(?P<slug>.*)/$', generic_comment_wrapper,    
            {"model":News, 
            "generic_view":object_detail,
            "generic_kwargs":{"queryset": News.active_objects.all(),
                                         "slug_field": "slug",
                                         "template_name": "news/detail.html"
                                         },
            
            }, name="news_detail")
) 
